package main

import (
	"strconv"
	"strings"
)

func compareVersion(version1 string, version2 string) int {
	v1 := strings.Split(version1, ".")
	v2 := strings.Split(version2, ".")
	for i, j := 0, 0; i < len(v1) || j < len(v2); {
		n1 := int64(0)
		if i < len(v1) && v1[i] != "" {
			n1, _ = strconv.ParseInt(v1[i], 10, 64)
		}

		n2 := int64(0)
		if j < len(v2) && v2[j] != "" {
			n2, _ = strconv.ParseInt(v2[j], 10, 64)
		}

		if n1 > n2 {
			return 1
		} else if n1 < n2 {
			return -1
		}

		i++
		j++
	}
	return 0
}

func main() {
	println(compareVersion("1.0", "1.0"))
	println(compareVersion("1.0", "1"))
	println(compareVersion("1.0", "2"))
	println(compareVersion("1.0.1", "1"))
	println(compareVersion("7.5.2.4", "7.5.3"))
	println(compareVersion("1.01", "1.001"))
	println(compareVersion("1.0", "1.00"))
}
